class AdminController < ReaderController
  before_filter :verify_session
  def index
    list
  end
  
  
  def list
    @readers_pages, @readers = paginate :readers, :per_page => 10 ,:conditions =>'is_admin = true'  
     render :action => 'list'
  end
  
  def new
    @reader = Reader.new
    @reader.is_admin = true
    init
  end
  
#  def create
#    @reader = Reader.new(params[:reader])
#    if @reader.save
#      flash[:notice] = "创建成功"
#      redirect_to :action => 'list'
#    else
#      flash[:notice] = "创建失败"  
#      render :controller => 'reader',:action => 'new'
#    end
#  end
  
#  def edit
#    init
#    @reader = findById(params[:id])
#  end
  
#  def update
#    @reader = findById(params[:id])
#    if @reader.update_attributes(params[:reader])
#      flash[:notice] = "更新成功"
#      redirect_to :action => 'list'
#    else
#      flash[:notice] = "更新失败"
#      render :controller => 'reader',:action => 'edit'
#    end
#  end
  
  
#  def destroy
#    findById(params[:id]).destroy
#    redirect_to :action=>'list'
#  end
  
  
#  private 
#  def findById(id)
#    Reader.find(id)
#  end
#  
#  def init
#    @departments = Department.find(:all)
#  end
end
